package be.xios.ti.droodle;

import java.awt.event.*;

/**
 * @author Kris Hermans
 */
public abstract class ShapeDrawAction {
	protected Shape shape;
	protected Drawing drawing;
	protected ShapeJPanel panel;
	private int clickCount;
	
	protected ShapeDrawAction(ShapeJPanel panel) {
		this.drawing = panel.getDrawing();
		this.panel = panel;
		clickCount = 0;
	}
	
	public void click(MouseEvent e) {
		clickCount++;
		doClick(e);
	}
	
	public int getClickCount() {
		return clickCount;
	}
	
	public void setClickCount(int c) {
		clickCount = c;
	}
	
	protected  abstract void doClick(MouseEvent e);
	
	protected final void ready() {
		drawing.add(shape);
		panel.repaint();
	}
}
